/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.zookeeper;

/**
 * 主要完成配额目录的定义
 *     - 限制信息包含对某个路径的要求大小(count或者bytes)
 *     - 状态信息包含对某个路径的实际大小(count或者bytes)
 *     - 以及提供path转换到对应的限制path和状态path的方法
 */
public class Quotas {

    /** the zookeeper nodes that acts as the management and status node **/
    public static final String procZookeeper = "/zookeeper";

    /**  配额目录 */
    public static final String quotaZookeeper = "/zookeeper/quota";

    /** node限制的结尾后缀 */
    public static final String limitNode = "zookeeper_limits";

    /** node实际状态的结尾后缀 */
    public static final String statNode = "zookeeper_stats";

    /**
     * zk某个节点path转换成对应的limit path
     * @param path the actual path in zookeeper.
     * @return the limit quota path
     */
    public static String quotaPath(String path) {
        return quotaZookeeper + path + "/" + limitNode;
    }

    /**
     * zk某个节点path转换成对应的stat path
     * @param path the actual path in zookeeper
     * @return the stat quota path
     */
    public static String statPath(String path) {
        return quotaZookeeper + path + "/" +
        statNode;
    }
}
